using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NTTHAO.Common;
using NTTHAO.CommonWeb;
using NTTHAO.Web.BL.Contact;

public partial class admin_webparts_Plug_ins_Contact_ContactGroupList : System.Web.UI.UserControl
{
    public DataTable _List = null;

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            int siteID = WebGlobal.GetSite().ID;
            int langID = LanguageUtility.GetLanguageID();

            int actived = Context.User.Identity.Name.Equals("admin", StringComparison.OrdinalIgnoreCase) ? -1 : 1;
            _List = ContactGroup.GetAll(siteID, langID, actived);

            if (_List != null && _List.Rows.Count == 1 && !Context.User.Identity.Name.Equals("admin", StringComparison.OrdinalIgnoreCase))
            {
                string url = Request.ServerVariables["QUERY_STRING"] + "&action=viewgroup&id=" + _List.Rows[0][ContactGroup.ID__COLUMN_NAME].ToString();
                Response.Redirect(url, false);
            }
        }
        catch (Exception)
        { }
    }
}
